package com.game;

import java.util.Scanner;

public class Player extends Role {

    public int generate() {
        Scanner scan = new Scanner(System.in);
        //人输入0剪刀 1布 2石头
        System.out.println("请输入你的拳（0剪刀 1布 2石头）：");
        while (true) {
            try {
                int number = scan.nextInt();
                if (number < 0 || number > 2) {
                    System.out.println("您的输入范围不正确，请重新输入！");
                } else {
                    return number;
                }
            } catch (Exception e) {
                System.out.println("输入格式有误，请重新输入！");
                scan.next();
            }

        }
    }


}